/*
 * ============================================================================
 * = COPYRIGHT
 *          PAX Computer Technology(Shenzhen) Co., Ltd. PROPRIETARY INFORMATION
 *   This software is supplied under the terms of a license agreement or nondisclosure
 *   agreement with PAX Computer Technology(Shenzhen) Co., Ltd. and may not be copied or
 *   disclosed except in accordance with the terms in that agreement.
 *     Copyright (C) 2021 PAX Computer Technology(Shenzhen) Co., Ltd. All rights reserved.
 * ============================================================================
 */

import 'package:pigeon/pigeon.dart';


@ConfigurePigeon(PigeonOptions(
    dartOut: 'lib/auto_pigeon/poslink_sdk_device.dart',
    javaOptions: JavaOptions(
      className: 'POSLinkDevice',
      package: 'com.example.pos_link.pigeon',
    ),
    objcOptions: ObjcOptions(prefix: ''),
    javaOut: './android/src/main/java/com/example/pos_link/pigeon/POSLinkDevice.java',
  ),
)
class DeviceCardInsertDetectionRequest {
  String? classID;
}

class DevicePrinterRequest {
  String? printCopy;
  String? printData;
}

class DeviceCameraScanRequest {
  DeviceReaderType? reader;
  String? timeout;
}

class DeviceMifareCardRequest {
  DeviceM1CommandType? m1Command;
  String? blockNumber;
  String? password;
  DevicePasswordType? passwordType;
  String? blockValue;
  String? updateBlockNumber;
  String? timeout;
}

class DeviceCameraScanResponse {
  String? responseCode;
  String? responseMessage;
  String? barcodeData;
  DeviceBarcodeType? barcodeType;
}

class DeviceCardInsertDetectionResponse {
  String? responseCode;
  String? responseMessage;
  DeviceCardInsertStatus? cardInsertStatus;
}

class DeviceMifareCardResponse {
  String? responseCode;
  String? responseMessage;
  String? blockValue;
}

class DevicePrinterResponse {
  String? responseCode;
  String? responseMessage;
}

enum DeviceCardInsertStatus {
  NotSet,
  NoCardInserted,
  EmvCardInserted,
  CardInserted,
}

enum DeviceBarcodeType {
  NotSet,
  QrCode,
  TwoDimensionalBarcode,
  ThreeDimensionalBarcode,
}

enum DeviceM1CommandType {
  NotSet,
  Read,
  Write,
  OperateWithIncreaseValue,
  OperateWithDecreaseValue,
  OperateWithBackupValue,
  ReadTheSerialNumber,
}

enum DevicePasswordType {
  NotSet,
  AType,
  BType,
}

enum DeviceReaderType {
  NotSet,
  RearCamera,
  FrontCamera,
}

@HostApi()
abstract class POSLinkDeviceApi {
   @async
   DeviceMifareCardResponse mifareCard(DeviceMifareCardRequest req);
   @async
   DeviceCameraScanResponse cameraScan(DeviceCameraScanRequest req);
   @async
   DevicePrinterResponse printer(DevicePrinterRequest req);
   @async
   DeviceCardInsertDetectionResponse cardInsertDetection(DeviceCardInsertDetectionRequest req);
}
